package com.newtype.meeting.client;

import com.extjs.gxt.ui.client.GXT;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.mvc.Dispatcher;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.newtype.meeting.client.mvc.AppController;
import com.newtype.meeting.client.mvc.backend.BackendController;
import com.newtype.meeting.client.mvc.frontend.MeetingController;
import com.newtype.meeting.client.mvc.frontend.StartMeetingController;
import com.newtype.meeting.client.mvc.frontend.StartMeetingListController;
import com.newtype.meeting.client.service.AccountService;
import com.newtype.meeting.client.service.DepartmentService;
import com.newtype.meeting.client.service.LoginService;
import com.newtype.meeting.client.service.MeetingCategoryService;
import com.newtype.meeting.client.service.MeetingService;
import com.newtype.meeting.client.service.MeetingStartService;
import com.newtype.meeting.client.service.TitleService;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class GMeeting implements EntryPoint {
	public static final String ACCOUNT_SERVICE = "account_service";
	public static final String TITLE_SERVICE = "title_service";
	public static final String DEPARTMENT_SERVICE = "department_service";
	public static final String CATEGORY_SERVICE = "category_service";
	public static final String MEETINGSTART_SERVICE = "meetingStart_service";
	public static final String MEETING_SERVICE = "meeting_service";
	public static final String CONSTANTS = "constants";
	public static final String LOGIN_SERVICE = "login_service";

	public static final String ACCOUNT = "account";
	public static final String LOGININFO = "loginInfo";
	public static final String CHECKEXIST = "checkexist";

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		Registry.register(ACCOUNT_SERVICE, GWT.create(AccountService.class));
		Registry.register(TITLE_SERVICE, GWT.create(TitleService.class));
		Registry.register(DEPARTMENT_SERVICE, GWT
				.create(DepartmentService.class));
		Registry.register(CATEGORY_SERVICE, GWT
				.create(MeetingCategoryService.class));
		Registry.register(MEETINGSTART_SERVICE, GWT
				.create(MeetingStartService.class));
		Registry.register(MEETING_SERVICE, GWT.create(MeetingService.class));
		Registry.register(CONSTANTS, GWT.create(MeetingConstants.class));//国际化
		Registry.register(LOGIN_SERVICE, GWT.create(LoginService.class));

		//DevTools.addAccount("admin", "admin", "管理员",
		//		"wgzkelvin@gmail.com", "13656202373", AccountType.ADMIN, "1");
		//DevTools.addTitle("专员", 0);

		Dispatcher dispatcher = Dispatcher.get();
		dispatcher.addController(new AppController());
		dispatcher.addController(new BackendController());
		dispatcher.addController(new MeetingController());
		dispatcher.addController(new StartMeetingController());
		dispatcher.addController(new StartMeetingListController());

		dispatcher.dispatch(AppEvents.Login);

		GXT.hideLoadingPanel("loading");
	}
}
